/**
 * Author: Shen Yanqiu
 * Date: 2017-12-18
 * Time: 9:58
 *
 */
import React from 'react';
import { Row, Col, Input, Button } from 'antd';
import styles from './ExamineInput.less';

class ExamineInput extends React.Component {
  state={
    value: '',
  };
  render () {
    const { submitExamine } = this.props;
    const change = (e) => {
      this.setState({ value: e.target.value });
    };
    // 通过
    const passHandler = () => {
      submitExamine({
        value: this.state.value,
        status: 'pass',
      });
      this.setState({ value: '' });
    };
    // 否决
    const vetoHandler = () => {
      submitExamine({
        value: this.state.value,
        status: 'veto',
      });
      this.setState({ value: '' });
    };
    return (
      <div className={styles.SubmitBlock}>
        <Row>
          <Col span={2} className={styles.SubmitBlocklabel}>审批意见：</Col>
          <Col span={16} className={styles.SubmitBlockInput}>
            <Input
              maxLength={"20"}
              placeholder={"请输入审批意见 0-20个字符（非必填）"}
              onChange={change}
              value={this.state.value}
            />
          </Col>
          <Col span={6} className={styles.SubmitBlockBtnGroup}>
            <Button type={"primary"} onClick={passHandler}>通过</Button>
            <Button type={"danger"} onClick={vetoHandler}>否决</Button>
          </Col>
        </Row>
      </div>
    );
  }
}
export default ExamineInput;
